
*libname TP_Data "The location of the data folder\TP_Pseudo";



/*Run this Macro to report Daniel, Grinblatt, Titman, and Wermers (1997) (DGTW) characteristic-adjusted mean returns and the Three- to Seven-factor model alphas*/

%MACRO DGTW_Ret_and_Alphas(Dataset=, DGTW_Ret_Var=, Ex_Ret_Var=);

Data Return_Data;
set &Dataset;
run;

proc means data= Return_Data mean stderr t prt ;
var  &DGTW_Ret_Var;
run;

proc reg data= Return_Data plots=none;
model &Ex_Ret_Var =MKTRF SMB HML;
run;

proc reg data= Return_Data plots=none;
model &Ex_Ret_Var =MKTRF SMB HML UMD;
run;

proc reg data= Return_Data plots=none;
model &Ex_Ret_Var =MKTRF SMB HML UMD PS_VWF;
run;

proc reg data= Return_Data plots=none;
model &Ex_Ret_Var =MKTRF SMB HML UMD PS_VWF ST_Rev;
run;

proc reg data= Return_Data plots=none;
model &Ex_Ret_Var =MKTRF SMB HML UMD PS_VWF ST_Rev LT_Rev;
run;

proc delete data= Return_Data ; run;

%mend DGTW_Ret_and_Alphas;







*** Table 3 ***;


** Panel A **;

%DGTW_Ret_and_Alphas(Dataset=TP_Data.Table_3_Panel_A, DGTW_Ret_Var=TP_DGTW_adj_ret, Ex_Ret_Var=TP_ex_ret)
%DGTW_Ret_and_Alphas(Dataset=TP_Data.Table_3_Panel_A, DGTW_Ret_Var=Rec_DGTW_adj_ret_ana, Ex_Ret_Var=Rec_ex_ret_ana)
%DGTW_Ret_and_Alphas(Dataset=TP_Data.Table_3_Panel_A, DGTW_Ret_Var=TP_Rec_diff_DGTW_Adj_ret_Ana, Ex_Ret_Var=TP_Rec_diff_ret_ana)


* Panel B *;

%DGTW_Ret_and_Alphas(Dataset=TP_Data.Table_3_Panel_B, DGTW_Ret_Var=TP_DGTW_adj_ret, Ex_Ret_Var=TP_ex_ret)
%DGTW_Ret_and_Alphas(Dataset=TP_Data.Table_3_Panel_B, DGTW_Ret_Var=Rec_DGTW_adj_ret_ind, Ex_Ret_Var=Rec_ex_ret_ind)
%DGTW_Ret_and_Alphas(Dataset=TP_Data.Table_3_Panel_B, DGTW_Ret_Var=TP_Rec_diff_DGTW_Adj_ret_ind, Ex_Ret_Var=TP_Rec_diff_ret_ind)


* Panel C *;

%DGTW_Ret_and_Alphas(Dataset=TP_Data.Table_3_Panel_C, DGTW_Ret_Var=TP_DGTW_adj_ret, Ex_Ret_Var=TP_ex_ret)
%DGTW_Ret_and_Alphas(Dataset=TP_Data.Table_3_Panel_C, DGTW_Ret_Var=Rec_BSB_DGTW_adj_ret_ana, Ex_Ret_Var=Rec_BSB_ex_ret_ana)
%DGTW_Ret_and_Alphas(Dataset=TP_Data.Table_3_Panel_C, DGTW_Ret_Var=TP_BSB_Rec_diff_DGTW_adj_ret_ana, Ex_Ret_Var=TP_Rec_BSB_diff_ret_ana)
%DGTW_Ret_and_Alphas(Dataset=TP_Data.Table_3_Panel_C, DGTW_Ret_Var=Rec_SB_DGTW_adj_ret_ana, Ex_Ret_Var=Rec_SB_ex_ret_ana)
%DGTW_Ret_and_Alphas(Dataset=TP_Data.Table_3_Panel_C, DGTW_Ret_Var=TP_SB_Rec_diff_DGTW_adj_ret_ana, Ex_Ret_Var=TP_Rec_SB_diff_ret_ana)


* Panel D *;

%DGTW_Ret_and_Alphas(Dataset=TP_Data.Table_3_Panel_D, DGTW_Ret_Var=TP_DGTW_adj_ret, Ex_Ret_Var=TP_ex_ret)
%DGTW_Ret_and_Alphas(Dataset=TP_Data.Table_3_Panel_D, DGTW_Ret_Var=Rec_BSB_DGTW_adj_ret_ind, Ex_Ret_Var=Rec_BSB_ex_ret_ind)
%DGTW_Ret_and_Alphas(Dataset=TP_Data.Table_3_Panel_D, DGTW_Ret_Var=TP_BSB_Rec_diff_DGTW_adj_ret_ind, Ex_Ret_Var=TP_Rec_BSB_diff_ret_ind)
%DGTW_Ret_and_Alphas(Dataset=TP_Data.Table_3_Panel_D, DGTW_Ret_Var=Rec_SB_DGTW_adj_ret_ind, Ex_Ret_Var=Rec_SB_ex_ret_ind)
%DGTW_Ret_and_Alphas(Dataset=TP_Data.Table_3_Panel_D, DGTW_Ret_Var=TP_SB_Rec_diff_DGTW_adj_ret_ind, Ex_Ret_Var=TP_Rec_SB_diff_ret_ind)


